package com.monboo.album.view.component
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import com.monboo.album.view.AlbumInfoMediator;
	

	public class Animation extends AbstractChangeUI
	{
		private var _animationUrl:String;
		private var animationContent:Sprite;
		
		public function Animation(animationUrl:String,_imageInfo:AlbumInfoMediator)
		{
			super(_imageInfo);
			_animationUrl = animationUrl;
			init();
		}
		private function init():void{
			
			animationContent = new Sprite();
			animationContent.name = "animationContent";
			addChild(animationContent);
			
			var load:Loader = new Loader();
			load.load(new URLRequest(_animationUrl));
			animationContent.addChild(load);
			
			load.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
			
		}
		
		private function loaded(e:Event):void{
			
			dispatchEvent(new Event("animationLoaded"));
			changeSize(animationContent);
			this.visible = true;
		}
		
		
	}
}